<?php # $this->load->view('layouts/_flash'); ?>

<div class="ui-corner-all contentContainer" style="background-color: #fff;">

<div style="position: relative;">

<div style="float: left;">
<div class="ui-corner-top side_menu" style="width: 700px;">Register</div>
<div style="border:1px  solid #286bcc;">
<div>&nbsp;</div>
<div>
<?echo validation_errors();?>
<?if(isset($system_message))echo $system_message;?>
<?php 
echo form_open('users/register', array('class' => 'admin-form'));
?>

<div class="inner-border">
	<?php
$formAttrib = array('class'=> 'admin-form', 'name' => 'frm_addstudent');
$idNo = rand(1000, 3000);
$studentTypeAttrib = array('' => 'Select Student Type...', 'new' => 'New', 'old' => 'Old', 'returnee' => 'Returnee', 'cross' => 'Cross' );

//Account Details
$idNoAttrib = array('name' => 'idno', 'value' => $idNo, 'id' => 'idno', 'readonly' => 'readonly');
$userNameAttrib = array('name' => 'username', 'value' => $idNo, 'id' => 'username', 'readonly' => 'readonly');
$passwordAttrib = array('name' => 'password', 'value' => $idNo, 'id' => 'password', 'readonly' => 'readonly');


if(!empty($levels)){
	$levelAttrib = array('' => 'Select level...');
	foreach($levels as $level){
		$levelAttrib[$level->level_id] = strtoupper($level->level_code).' - '.$level->level_desc;
	}
}
else
{
	$levelAttrib = array('' => 'No levels available');
}

// Personal Information fields
$lNameAttrib = array('name' => 'lastname', 'id' => 'lastname', 'value' => set_value('lastname'));
$fNameAttrib = array('name' => 'firstname', 'id' => 'firstname', 'value' => set_value('firstname'));
$mNameAttrib = array('name' => 'middlename', 'id' => 'middlename', 'value' => set_value('middlename'));
$genderAttrib = array('' => 'Select Gender...', 'male' => 'Male', 'female' => 'Female' );
$civilStatusAttrib = array('' => 'Select Civil Status...', 'Single' => 'Single', 'Married' => 'Married', 'Divorced' => 'Divorced' );
$dobAttrib = array('name' => 'dob', 'id' => 'dob', 'value' => set_value('dob'), 'class' => 'datepicker');
$pobAttrib = array('name' => 'pob', 'id' => 'pob', 'value' => set_value('pob'));
$ageAttrib = array('name' => 'age', 'id' => 'age', 'value' => set_value('age'));
$disabilityAttrib = array('name' => 'disability', 'id' => 'disability');
$nationalityAttrib = array('name' => 'nationality', 'id' => 'nationality', 'value' => set_value('nationality'));
$religionAttrib = array('name' => 'religion', 'id' => 'religion', 'value' => set_value('religion'));
$contactNumberAttrib = array('name' => 'contact_no', 'id' => 'contact_no', 'value' => set_value('contact_no'));
$emailAttrib = array('name' => 'email', 'id' => 'email', 'value' => set_value('email'));
$presentAddressAttrib = array('name' =>'present_address', 'id' => 'present_address', 'value' => set_value('present_address'));
$fatherNameAttrib = array('name' => 'fathername', 'id' => 'fathername', 'value' => set_value('fathername'));
$fatherOccupationAttrib = array('name' => 'father_occupation', 'id' => 'father_occupation', 'value' => set_value('father_occupation'));
$fatherContactAttrib = array('name' => 'father_contact_no', 'id' => 'father_contact_no', 'value' => set_value('father_contact_no'));
$motherNameAttrib = array('name' => 'mothername', 'id' => 'mothername', 'value' => set_value('mothername'));
$motherOccupationAttrib = array('name' => 'mother_occupation', 'id' => 'mother_occupation', 'value' => set_value('mother_occupation'));
$motherContactAttrib = array('name' => 'mother_contact_no', 'id' => 'mother_contact_no', 'value' => set_value('mother_contact_no'));
$parentAddressAttrib = array('name' => 'parent_address', 'id' => 'parent_address', 'value' => set_value('parent_address'));
$guardianNameAttrib = array('name' => 'guardian_name', 'id' => 'guardian_name', 'value' => set_value('guardian_name'));
$relationshipAttrib = array('name' => 'relationship', 'id' => 'relationship', 'value' => set_value('relationship'));
$guardianContactAttrib = array('name' => 'guardian_contact_no', 'id' => 'guardian_contact_no', 'value' => set_value('guardian_contact_no'));
$guardianAddressAttrib = array('name' => 'guardian_address', 'id' => 'guardian_address', 'value' => set_value('guardian_address'));

// Last school attended
$lSchoolNameAttrib= array('name' => 'last_school_name', 'id' => 'last_school_name', 'value' => set_value('last_school_name'));
$lSchoolAddressAttrib = array('name' => 'last_school_address', 'id' => 'last_school_address', 'value' => set_value('last_school_address'));
$lSchoolLevelAttrib = array('name' => 'last_school_level', 'id' => 'last_school_level', 'value' => set_value('last_school_level'));
$lSchoolYearAttrib = array('name' => 'last_school_year', 'id' => 'last_school_year', 'value' => set_value('last_school_year'));

?>


<?php echo form_fieldset('Account Details');?>

<div class="notice">Your password is the same as your username, please change it upon successful registration!</div>

<div class="input-block">
	<?php
		echo form_label('IDNO', 'idno');
		echo form_input($idNoAttrib);		
	?>
</div>
<div class="input-block">
 	<?php
		echo form_label('Student type <strong>*</strong>', 'student_type');
    	echo form_dropdown('student_type', $studentTypeAttrib, set_value('student_type'));
	?>
</div>

<div class="input-block">
    <?php
		echo form_label('Username', 'username');
		echo form_input($userNameAttrib);		
	?>
    </div>
    
    <div class="input-block">
    <?php
		echo form_label('Password', 'password');
		echo form_password($passwordAttrib);
	?>
    </div>
    
   <div class="input-block">
	<?php
		echo form_label('Level <strong>*</strong>', 'year_level_id');
    	echo form_dropdown('level_id', $levelAttrib, set_value('level_id'));
	?>
    </div>
<?php echo form_fieldset_close(); ?>

<?php echo form_fieldset('Personal Information');?>
<div class="input-block">
 	<?php
		echo form_label('Last Name <strong>*</strong>', 'lastname');
    	echo form_input($lNameAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('First Name <strong>*</strong>', 'firstname');
    	echo form_input($fNameAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Middle Name <strong>*</strong>', 'middlename');
    	echo form_input($mNameAttrib);
	?>
</div>


<div class="input-block">
 	<?php
		echo form_label('Gender <strong>*</strong>', 'gender');
    	echo form_dropdown('gender', $genderAttrib, set_value('gender'));
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Civil Status <strong>*</strong>', 'civilstatus');
    	echo form_dropdown('civilstatus', $civilStatusAttrib, set_value('civilstatus'));
	?>
</div>


<div class="input-block">
 	<?php
		echo form_label('Date of Birth <strong>*</strong>', 'dob');
    	echo form_input($dobAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Place of Birth <strong>*</strong>', 'pob');
    	echo form_input($pobAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Age <strong>*</strong>', 'age');
    	echo form_input($ageAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Disability', 'disability');
    	echo form_input($disabilityAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Nationality <strong>*</strong>', 'nationality');
    	echo form_input($nationalityAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Religion <strong>*</strong>', 'religion');
    	echo form_input($religionAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Contact Number <strong>*</strong>', 'contact_no');
    	echo form_input($contactNumberAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Email <strong>*</strong>', 'email');
    	echo form_input($emailAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Present Address <strong>*</strong>', 'present_address');
    	echo form_input($presentAddressAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Father\'s Name <strong>*</strong>', 'fathername');
    	echo form_input($fatherNameAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Occupation <strong>*</strong>', 'father_occupation');
    	echo form_input($fatherOccupationAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Contact Number <strong>*</strong>', 'father_contact_no');
    	echo form_input($fatherContactAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Mother\'s Name <strong>*</strong>', 'mothername');
    	echo form_input($motherNameAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Occupation <strong>*</strong>', 'mother_occupation');
    	echo form_input($motherOccupationAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Contact Number <strong>*</strong>', 'mother_contact_no');
    	echo form_input($motherContactAttrib);	
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Parent\'s Address <strong>*</strong>', 'parent_address');
    	echo form_input($parentAddressAttrib);	
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Guardian Name <strong>*</strong>', 'guardian_name');
    	echo form_input($guardianNameAttrib);	
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Relationship <strong>*</strong>', 'relationship');
    	echo form_input($relationshipAttrib);	
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Contact Number <strong>*</strong>', 'guardian_contact_no');
    	echo form_input($guardianContactAttrib);	
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Guardian Address <strong>*</strong>', 'guardian_address');
    	echo form_input($guardianAddressAttrib);	
	?>
</div>

<?php echo form_fieldset_close();?>

<?php echo form_fieldset('Last school attended');?>

<div class="input-block">
 	<?php
		echo form_label('School Name <strong>*</strong>', 'last_school_name');
    	echo form_input($lSchoolNameAttrib);	
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('School Address <strong>*</strong>', 'last_school_address');
    	echo form_input($lSchoolAddressAttrib);	
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Level <strong>*</strong>', 'last_school_level');
    	echo form_input($lSchoolLevelAttrib);
	?>
</div>

<div class="input-block">
 	<?php
		echo form_label('Year<strong>*</strong>', 'last_school_year');
    	echo form_input($lSchoolYearAttrib);	
	?>
</div>



<?php echo form_fieldset_close();?>

<div class="input-block">
	<a href="<?=site_url('home');?>" class="btn">Back</a>
 	<?php echo form_submit('submit', 'Submit');?>
</div>

</div>

<?php
echo form_close();
?>

</div>
<div class="clearfloat"></div>
</div>
<div>&nbsp;</div>
</div>
</div>
<div class="clearfloat"></div>
</div>

</div>